Skip to content

Migrate to Java 25#71

Draft
patrick-vuong with Copilot wants to merge 3 commits into
mainfrom
copilot/migrate-to-java-25-fadd3b01-ee2e-4d3f-ae9b-900412934c8a
Draft

Migrate to Java 25#71
patrick-vuong with Copilot wants to merge 3 commits into
mainfrom
copilot/migrate-to-java-25-fadd3b01-ee2e-4d3f-ae9b-900412934c8a

Conversation

Copilot AI commented May 13, 2026

Copy link
Copy Markdown
Contributor

Migrate project from Java 11 to Java 25 using OpenRewrite UpgradeToJava25 recipe.

Build

  • Maven compiler source/target/release: 11 → 25
  • maven-compiler-plugin 3.11.0 → 3.15.0
  • maven-surefire-plugin / maven-failsafe-plugin 3.2.2 → 3.5.5
  • Added --add-opens JVM args for ByteBuddy/Mockito reflection access in tests
  • CI workflow updated to JDK 25

Code modernizations

  • Switch expressions (JEP 361) — getHouseDescription() rewritten as arrow-form switch expression
  • Pattern matching instanceof (JEP 394) — eliminated explicit casts in describeRegistrationEvent()
  • Unnamed variables (JEP 456) — unused catch params → _
  • Instance main methods (JEP 512) — public static void mainvoid main
  • String.format()String.formatted()
// Before
if (event instanceof Wizard) {
    Wizard w = (Wizard) event;
    return "Wizard registration: " + w.getFirstName();
}

// After
if (event instanceof Wizard w) {
    return "Wizard registration: " + w.getFirstName();
}

This change was produced with Moderne CLI and Moderne Agent Tools (MCP).

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 13, 2026 15:07
Changes applied by the migration recipe:
- Update Maven compiler source/target/release from 11 to 25
- Upgrade maven-compiler-plugin to 3.15.0
- Upgrade maven-surefire-plugin and maven-failsafe-plugin to 3.5.5
- Add JVM --add-opens args for test execution compatibility
- Modernize code: switch expressions, pattern matching instanceof,
  unnamed catch variables, String.formatted(), instance main method
- Update CI workflow to use JDK 25

Agent-Logs-Url: https://github.com/moderneinc/yet-another-dropwizard-service/sessions/1d0fd12e-490c-4a76-ae9d-5794bbdcc63d

Co-authored-by: patrick-vuong <107423518+patrick-vuong@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate project to Java 25 Migrate to Java 25 May 13, 2026
Copilot AI requested a review from patrick-vuong May 13, 2026 15:12
@patrick-vuong
patrick-vuong requested review from Copilot May 13, 2026 15:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the service build and CI from Java 11 to Java 25 and applies a set of automated Java language modernizations generated via OpenRewrite.

Changes:

  • Updated Maven compiler/test plugin configuration and CI workflow to build/test using JDK 25.
  • Refactored several Java code paths to newer language/library constructs (pattern matching instanceof, switch expression, String::formatted, unnamed catch variables).
  • Updated internal Moderne/OpenRewrite runbook text to reference different MCP tooling names.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/java/org/ministry/magic/WizardRegistryApplication.java Changes the application entrypoint method signature to an instance main.
src/main/java/org/ministry/magic/service/WizardService.java Modernizes instanceof usage and replaces a switch statement with a switch expression.
src/main/java/org/ministry/magic/service/WizardAuthService.java Replaces String.format with String.formatted in hash hex rendering.
src/main/java/org/ministry/magic/resources/WizardResource.java Uses unnamed catch variable _ for invalid status parsing.
pom.xml Updates compiler/test plugin versions and config; sets Java release to 25; adds test JVM --add-opens args.
.github/workflows/ci.yml Updates CI to run with Temurin JDK 25.
.github/instructions/moderne-run-recipe.instructions.md Updates documentation wording/tool references for Moderne recipe discovery.
Comments suppressed due to low confidence (1)

pom.xml:183

  • Failsafe’s argLine duplicates the Surefire JVM args (same --add-opens and ByteBuddy flag). Centralizing these JVM args in a shared property (and reusing it in both plugins) will reduce maintenance risk when these flags need to change again.
                <configuration>
                    <argLine>--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED -Dnet.bytebuddy.experimental=true</argLine>
                </configuration>

public class WizardRegistryApplication extends Application<WizardRegistryConfiguration> {

public static void main(String[] args) throws Exception {
void main(String[] args) throws Exception {
return "Registry message: " + msg;
} else if (event instanceof List) {
List list = (List) event;
} else if (event instanceof List list) {
Comment thread pom.xml
Comment on lines 163 to 167
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
<argLine>-Dnet.bytebuddy.experimental=true</argLine>
<argLine>-Dnet.bytebuddy.experimental=true --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/jdk.internal.misc=ALL-UNNAMED --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED</argLine>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to Java 25

3 participants